package cn.jiyun.service;

import cn.jiyun.mapper.StudentMapper;
import cn.jiyun.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.Id;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class StudentService {

    @Autowired
    StudentMapper studentMapper;

    public List<Student> findAll() {
        return studentMapper.findAll();
    }


    public void insert(Student student) {
        Student s = new Student();
        s.setId(1);
        s.setName("大哥");
        s.setSex("女");
        s.setHobby("篮球");
       s.setBirthday(null);
        studentMapper.add(s);
    }

    public void update(Student student) {
        Student student1=new Student();
        student1.setId(9);
        student1.setName("无奈了");
        student1.setSex("女");
        student1.setHobby("排球");
        student1.setBirthday(null);
        studentMapper.update(student1);
    }

    public void delete(Integer id) {

        studentMapper.delete(3);
    }
}
